.class public Llt/noframe/gpsfarmguide/models/PolygonModel;
.super Ljava/lang/Object;
.source "PolygonModel.java"

# interfaces
.implements Llt/noframe/gpsfarmguide/interfaces/Shape;


# instance fields
.field private caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

.field private markers:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/Marker;",
            ">;"
        }
    .end annotation
.end field

.field private originator:Llt/noframe/gpsfarmguide/undo/Originator;

.field private points:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/LatLng;",
            ">;"
        }
    .end annotation
.end field

.field private polygon:Lcom/google/android/gms/maps/model/Polygon;

.field private toast:Llt/noframe/gpsfarmguide/widgets/MegaToast;


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 40
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 34
    new-instance v0, Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/undo/Caretaker;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    .line 35
    new-instance v0, Llt/noframe/gpsfarmguide/undo/Originator;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/undo/Originator;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    .line 41
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    .line 42
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    return-void
.end method

.method public constructor <init>(Ljava/util/List;)V
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/LatLng;",
            ">;)V"
        }
    .end annotation

    .line 45
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 34
    new-instance v0, Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/undo/Caretaker;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    .line 35
    new-instance v0, Llt/noframe/gpsfarmguide/undo/Originator;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/undo/Originator;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    .line 46
    iput-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    .line 47
    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Drawing;->drawPolygon(Ljava/util/List;)Lcom/google/android/gms/maps/model/Polygon;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    const/4 v0, 0x1

    .line 48
    invoke-static {p1, v0}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMarkers(Ljava/util/List;Z)Ljava/util/List;

    move-result-object p1

    iput-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    return-void
.end method

.method private insertNextMidPoint(Lcom/google/android/gms/maps/model/LatLng;)V
    .locals 2

    .line 106
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    const/4 v1, 0x0

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/google/android/gms/maps/model/LatLng;

    invoke-static {p1, v1}, Llt/noframe/gpsfarmguide/utils/Mathematics;->getMidPoint(Lcom/google/android/gms/maps/model/LatLng;Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object p1

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 107
    iget-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/android/gms/maps/model/LatLng;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMidMarker(Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object v0

    invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    return-void
.end method

.method private insertPoint(Lcom/google/android/gms/maps/model/LatLng;)V
    .locals 1

    .line 96
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 97
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMarker(Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object p1

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    return-void
.end method

.method private insertPreviousMidPoint(Lcom/google/android/gms/maps/model/LatLng;)V
    .locals 2

    .line 101
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/google/android/gms/maps/model/LatLng;

    invoke-static {v1, p1}, Llt/noframe/gpsfarmguide/utils/Mathematics;->getMidPoint(Lcom/google/android/gms/maps/model/LatLng;Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object p1

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 102
    iget-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/android/gms/maps/model/LatLng;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMidMarker(Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object v0

    invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    return-void
.end method

.method private removeLastMidPoint()V
    .locals 2

    .line 90
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-interface {v0, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    .line 91
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/google/android/gms/maps/model/Marker;

    invoke-virtual {v0}, Lcom/google/android/gms/maps/model/Marker;->remove()V

    .line 92
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v1

    add-int/lit8 v1, v1, -0x1

    invoke-interface {v0, v1}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    return-void
.end method

.method private removeNextMidPoint(Lcom/google/android/gms/maps/model/Marker;)V
    .locals 2

    .line 118
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->getCurrent_measuring()Llt/noframe/gpsfarmguide/models/MeasuringModel;

    move-result-object v0

    invoke-virtual {v0, p1}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getNextMarker(Lcom/google/android/gms/maps/model/Marker;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object p1

    .line 119
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Marker;->getPosition()Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 120
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 121
    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Marker;->remove()V

    return-void
.end method

.method private removePreviousMidPoint(Lcom/google/android/gms/maps/model/Marker;)V
    .locals 2

    .line 111
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->getCurrent_measuring()Llt/noframe/gpsfarmguide/models/MeasuringModel;

    move-result-object v0

    invoke-virtual {v0, p1}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getPreviousMarker(Lcom/google/android/gms/maps/model/Marker;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object p1

    .line 112
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Marker;->getPosition()Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 113
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 114
    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Marker;->remove()V

    return-void
.end method


# virtual methods
.method public addMarkers()V
    .locals 2

    .line 153
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    const/4 v1, 0x1

    invoke-static {v0, v1}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMarkers(Ljava/util/List;Z)Ljava/util/List;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    return-void
.end method

.method public addPoint(Lcom/google/android/gms/maps/model/LatLng;)V
    .locals 5

    .line 68
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->saveState()V

    .line 69
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    if-eqz v0, :cond_0

    .line 70
    invoke-virtual {v0}, Lcom/google/android/gms/maps/model/Polygon;->remove()V

    .line 71
    :cond_0
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    const/4 v1, 0x2

    if-ne v0, v1, :cond_1

    .line 72
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    const/4 v2, 0x0

    invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/google/android/gms/maps/model/LatLng;

    iget-object v3, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    const/4 v4, 0x1

    invoke-interface {v3, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lcom/google/android/gms/maps/model/LatLng;

    invoke-static {v2, v3}, Llt/noframe/gpsfarmguide/utils/Mathematics;->getMidPoint(Lcom/google/android/gms/maps/model/LatLng;Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v2

    invoke-interface {v0, v4, v2}, Ljava/util/List;->add(ILjava/lang/Object;)V

    .line 73
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    iget-object v2, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v2, v4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/google/android/gms/maps/model/LatLng;

    invoke-static {v2}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMidMarker(Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object v2

    invoke-interface {v0, v4, v2}, Ljava/util/List;->add(ILjava/lang/Object;)V

    .line 75
    :cond_1
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-le v0, v1, :cond_3

    .line 76
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    const/4 v1, 0x3

    if-eq v0, v1, :cond_2

    .line 77
    invoke-direct {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->removeLastMidPoint()V

    .line 78
    :cond_2
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/models/PolygonModel;->insertPreviousMidPoint(Lcom/google/android/gms/maps/model/LatLng;)V

    .line 79
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/models/PolygonModel;->insertPoint(Lcom/google/android/gms/maps/model/LatLng;)V

    .line 80
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/models/PolygonModel;->insertNextMidPoint(Lcom/google/android/gms/maps/model/LatLng;)V

    goto :goto_0

    .line 83
    :cond_3
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/models/PolygonModel;->insertPoint(Lcom/google/android/gms/maps/model/LatLng;)V

    .line 85
    :goto_0
    invoke-static {}, Llt/noframe/gpsfarmguide/utils/Calculations;->getInstance()Llt/noframe/gpsfarmguide/utils/Calculations;

    move-result-object p1

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/utils/Calculations;->doAreaCalculations()V

    .line 86
    iget-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Drawing;->drawPolygon(Ljava/util/List;)Lcom/google/android/gms/maps/model/Polygon;

    move-result-object p1

    iput-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    return-void
.end method

.method public deletePoint(Lcom/google/android/gms/maps/model/Marker;)V
    .locals 3

    .line 158
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->saveState()V

    .line 159
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    const/4 v1, 0x5

    if-le v0, v1, :cond_0

    .line 160
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/models/PolygonModel;->removePreviousMidPoint(Lcom/google/android/gms/maps/model/Marker;)V

    .line 161
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/models/PolygonModel;->removeNextMidPoint(Lcom/google/android/gms/maps/model/Marker;)V

    .line 163
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    const/4 v1, 0x4

    if-le v0, v1, :cond_0

    .line 164
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->getCurrent_measuring()Llt/noframe/gpsfarmguide/models/MeasuringModel;

    move-result-object v0

    invoke-virtual {v0, p1}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getPreviousMarker(Lcom/google/android/gms/maps/model/Marker;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object v0

    invoke-virtual {v0}, Lcom/google/android/gms/maps/model/Marker;->getPosition()Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v0

    .line 165
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v1

    invoke-virtual {v1}, Llt/noframe/gpsfarmguide/Data;->getCurrent_measuring()Llt/noframe/gpsfarmguide/models/MeasuringModel;

    move-result-object v1

    invoke-virtual {v1, p1}, Llt/noframe/gpsfarmguide/models/MeasuringModel;->getNextMarker(Lcom/google/android/gms/maps/model/Marker;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object v1

    invoke-virtual {v1}, Lcom/google/android/gms/maps/model/Marker;->getPosition()Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    .line 164
    invoke-static {v0, v1}, Llt/noframe/gpsfarmguide/utils/Mathematics;->getMidPoint(Lcom/google/android/gms/maps/model/LatLng;Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v0

    .line 166
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Marker;->getPosition()Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v2

    invoke-interface {v1, v2}, Ljava/util/List;->indexOf(Ljava/lang/Object;)I

    move-result v2

    invoke-interface {v1, v2, v0}, Ljava/util/List;->add(ILjava/lang/Object;)V

    .line 167
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v1, p1}, Ljava/util/List;->indexOf(Ljava/lang/Object;)I

    move-result v2

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMidMarker(Lcom/google/android/gms/maps/model/LatLng;)Lcom/google/android/gms/maps/model/Marker;

    move-result-object v0

    invoke-interface {v1, v2, v0}, Ljava/util/List;->add(ILjava/lang/Object;)V

    .line 170
    :cond_0
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 171
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Marker;->getPosition()Lcom/google/android/gms/maps/model/LatLng;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 172
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    const/4 v1, 0x3

    if-ne v0, v1, :cond_2

    const/4 v0, 0x0

    .line 173
    :goto_0
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v1}, Ljava/util/List;->size()I

    move-result v1

    if-ge v0, v1, :cond_2

    .line 174
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/google/android/gms/maps/model/Marker;

    invoke-virtual {v1}, Lcom/google/android/gms/maps/model/Marker;->getSnippet()Ljava/lang/String;

    move-result-object v1

    const-string v2, "marker_mid"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 175
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/google/android/gms/maps/model/Marker;

    invoke-virtual {v1}, Lcom/google/android/gms/maps/model/Marker;->remove()V

    .line 176
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    .line 177
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v1, v0}, Ljava/util/List;->remove(I)Ljava/lang/Object;

    :cond_1
    add-int/lit8 v0, v0, 0x1

    goto :goto_0

    .line 181
    :cond_2
    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Marker;->remove()V

    .line 182
    iget-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    invoke-virtual {p1}, Lcom/google/android/gms/maps/model/Polygon;->remove()V

    .line 183
    iget-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result p1

    if-lez p1, :cond_3

    .line 184
    iget-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-static {p1}, Llt/noframe/gpsfarmguide/utils/Drawing;->drawPolygon(Ljava/util/List;)Lcom/google/android/gms/maps/model/Polygon;

    move-result-object p1

    iput-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    .line 186
    :cond_3
    invoke-static {}, Llt/noframe/gpsfarmguide/utils/Calculations;->getInstance()Llt/noframe/gpsfarmguide/utils/Calculations;

    move-result-object p1

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/utils/Calculations;->doAreaCalculations()V

    return-void
.end method

.method public doCalculations()V
    .locals 1

    .line 233
    invoke-static {}, Llt/noframe/gpsfarmguide/utils/Calculations;->getInstance()Llt/noframe/gpsfarmguide/utils/Calculations;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/utils/Calculations;->doAreaCalculations()V

    return-void
.end method

.method public draw()V
    .locals 1

    .line 223
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Drawing;->drawPolygon(Ljava/util/List;)Lcom/google/android/gms/maps/model/Polygon;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    return-void
.end method

.method public getMarkers()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/Marker;",
            ">;"
        }
    .end annotation

    .line 63
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    return-object v0
.end method

.method public getPoints()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/LatLng;",
            ">;"
        }
    .end annotation

    .line 53
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    return-object v0
.end method

.method public getType()I
    .locals 1

    const/4 v0, 0x2

    return v0
.end method

.method public getWkt()Ljava/lang/String;
    .locals 1

    .line 265
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Utils;->polygonPoints2WKT(Ljava/util/List;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public markMeasure()V
    .locals 2

    .line 142
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    const/high16 v1, 0x40400000    # 3.0f

    invoke-virtual {v0, v1}, Lcom/google/android/gms/maps/model/Polygon;->setStrokeWidth(F)V

    return-void
.end method

.method public redraw()V
    .locals 2

    .line 215
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    if-eqz v0, :cond_0

    .line 216
    invoke-virtual {v0}, Lcom/google/android/gms/maps/model/Polygon;->remove()V

    .line 217
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    invoke-virtual {v1}, Lcom/google/android/gms/maps/model/Polygon;->getFillColor()I

    move-result v1

    invoke-static {v0, v1}, Llt/noframe/gpsfarmguide/utils/Drawing;->drawPolygon(Ljava/util/List;I)Lcom/google/android/gms/maps/model/Polygon;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    :cond_0
    return-void
.end method

.method public remove()V
    .locals 2

    .line 126
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    if-eqz v0, :cond_0

    .line 127
    invoke-virtual {v0}, Lcom/google/android/gms/maps/model/Polygon;->remove()V

    .line 128
    :cond_0
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->removeMarkers()V

    .line 129
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->getAreas()Ljava/util/List;

    move-result-object v0

    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v1

    invoke-virtual {v1}, Llt/noframe/gpsfarmguide/Data;->getCurrent_measuring()Llt/noframe/gpsfarmguide/models/MeasuringModel;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    return-void
.end method

.method public removeMarkers()V
    .locals 2

    .line 134
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/google/android/gms/maps/model/Marker;

    .line 135
    invoke-virtual {v1}, Lcom/google/android/gms/maps/model/Marker;->remove()V

    goto :goto_0

    .line 136
    :cond_0
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    return-void
.end method

.method public restoreInitialState()V
    .locals 2

    .line 246
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/Caretaker;->getSavedStatesCount()I

    move-result v0

    if-eqz v0, :cond_1

    .line 247
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-virtual {v1}, Llt/noframe/gpsfarmguide/undo/Caretaker;->getFirstMemento()Llt/noframe/gpsfarmguide/undo/AbstractMemento;

    move-result-object v1

    invoke-virtual {v0, v1}, Llt/noframe/gpsfarmguide/undo/Originator;->restoreFromMemento(Llt/noframe/gpsfarmguide/undo/AbstractMemento;)V

    .line 248
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/Originator;->getState()Ljava/util/List;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    .line 249
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    if-eqz v0, :cond_0

    .line 250
    invoke-virtual {v0}, Lcom/google/android/gms/maps/model/Polygon;->remove()V

    .line 251
    :cond_0
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->removeMarkers()V

    .line 252
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-lez v0, :cond_1

    .line 253
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Drawing;->drawPolygon(Ljava/util/List;)Lcom/google/android/gms/maps/model/Polygon;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    :cond_1
    return-void
.end method

.method public saveState()V
    .locals 2

    .line 238
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-virtual {v0, v1}, Llt/noframe/gpsfarmguide/undo/Originator;->setState(Ljava/util/List;)V

    .line 239
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    invoke-virtual {v1}, Llt/noframe/gpsfarmguide/undo/Originator;->saveToMemento()Llt/noframe/gpsfarmguide/undo/Memento;

    move-result-object v1

    invoke-virtual {v0, v1}, Llt/noframe/gpsfarmguide/undo/Caretaker;->add(Llt/noframe/gpsfarmguide/undo/Memento;)V

    return-void
.end method

.method public setColor(I)V
    .locals 1

    .line 228
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    invoke-virtual {v0, p1}, Lcom/google/android/gms/maps/model/Polygon;->setFillColor(I)V

    return-void
.end method

.method public setForEditing()V
    .locals 4

    .line 270
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->addMarkers()V

    .line 271
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->unmarkMeasure()V

    .line 272
    invoke-static {}, Llt/noframe/gpsfarmguide/Data;->getInstance()Llt/noframe/gpsfarmguide/Data;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/Data;->getMapStatesController()Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;

    move-result-object v0

    new-instance v1, Llt/noframe/gpsfarmguide/states/map_states/AreaDrawingState;

    invoke-direct {v1}, Llt/noframe/gpsfarmguide/states/map_states/AreaDrawingState;-><init>()V

    invoke-virtual {v0, v1}, Llt/noframe/gpsfarmguide/states/map_states/MapStatesController;->setCurrentState(Llt/noframe/gpsfarmguide/states/map_states/MapState;)V

    .line 273
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/Caretaker;->clear()V

    .line 274
    new-instance v0, Llt/noframe/gpsfarmguide/undo/Originator;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/undo/Originator;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    .line 275
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/Caretaker;->getSavedStatesCount()I

    .line 276
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->saveState()V

    .line 277
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/Caretaker;->getSavedStatesCount()I

    .line 278
    invoke-static {}, Llt/noframe/gpsfarmguide/utils/Calculations;->getInstance()Llt/noframe/gpsfarmguide/utils/Calculations;

    move-result-object v0

    invoke-static {}, Llt/noframe/gpsfarmguide/App;->getContext()Landroid/content/Context;

    move-result-object v1

    const-wide v2, 0x7fefffffffffffffL    # Double.MAX_VALUE

    invoke-virtual {v0, v1, v2, v3}, Llt/noframe/gpsfarmguide/utils/Calculations;->iniArea(Landroid/content/Context;D)V

    .line 279
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->doCalculations()V

    return-void
.end method

.method public setPoints(Ljava/util/List;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lcom/google/android/gms/maps/model/LatLng;",
            ">;)V"
        }
    .end annotation

    .line 58
    iput-object p1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    return-void
.end method

.method public undo()V
    .locals 2

    .line 192
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->caretaker:Llt/noframe/gpsfarmguide/undo/Caretaker;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/Caretaker;->getLastMemento()Llt/noframe/gpsfarmguide/undo/AbstractMemento;

    move-result-object v0

    .line 193
    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/AbstractMemento;->isNil()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 195
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->toast:Llt/noframe/gpsfarmguide/widgets/MegaToast;

    if-eqz v0, :cond_0

    invoke-virtual {v0}, Landroid/widget/Toast;->cancel()V

    .line 196
    :cond_0
    invoke-static {}, Llt/noframe/gpsfarmguide/App;->getContext()Landroid/content/Context;

    move-result-object v0

    const v1, 0x7f1100c1

    invoke-static {v0, v1}, Llt/noframe/gpsfarmguide/widgets/MegaToast;->showTextLong(Landroid/content/Context;I)Llt/noframe/gpsfarmguide/widgets/MegaToast;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->toast:Llt/noframe/gpsfarmguide/widgets/MegaToast;

    return-void

    .line 200
    :cond_1
    iget-object v1, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    invoke-virtual {v1, v0}, Llt/noframe/gpsfarmguide/undo/Originator;->restoreFromMemento(Llt/noframe/gpsfarmguide/undo/AbstractMemento;)V

    .line 201
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    if-eqz v0, :cond_2

    .line 202
    invoke-virtual {v0}, Lcom/google/android/gms/maps/model/Polygon;->remove()V

    .line 203
    :cond_2
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/models/PolygonModel;->removeMarkers()V

    .line 205
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->originator:Llt/noframe/gpsfarmguide/undo/Originator;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/undo/Originator;->getState()Ljava/util/List;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    .line 206
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-lez v0, :cond_3

    .line 207
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    invoke-static {v0}, Llt/noframe/gpsfarmguide/utils/Drawing;->drawPolygon(Ljava/util/List;)Lcom/google/android/gms/maps/model/Polygon;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    .line 208
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->points:Ljava/util/List;

    const/4 v1, 0x1

    invoke-static {v0, v1}, Llt/noframe/gpsfarmguide/utils/Drawing;->addMarkers(Ljava/util/List;Z)Ljava/util/List;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->markers:Ljava/util/List;

    .line 210
    :cond_3
    invoke-static {}, Llt/noframe/gpsfarmguide/utils/Calculations;->getInstance()Llt/noframe/gpsfarmguide/utils/Calculations;

    move-result-object v0

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/utils/Calculations;->doAreaCalculations()V

    return-void
.end method

.method public unmarkMeasure()V
    .locals 2

    .line 147
    iget-object v0, p0, Llt/noframe/gpsfarmguide/models/PolygonModel;->polygon:Lcom/google/android/gms/maps/model/Polygon;

    if-eqz v0, :cond_0

    const/high16 v1, 0x3f800000    # 1.0f

    .line 148
    invoke-virtual {v0, v1}, Lcom/google/android/gms/maps/model/Polygon;->setStrokeWidth(F)V

    :cond_0
    return-void
.end method
